package com.hl.card.modular.pack.controller;

import com.hl.card.common.persistence.dao.OperationLogMapper;
import com.hl.card.common.persistence.model.OperationLog;
import com.hl.card.common.util.ResponseObject;
import com.hl.card.common.util.ResponseUtil;
import com.hl.card.core.support.DateTime;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.annotation.Resource;

@RestController
@RequestMapping("/api/log")
public class UlogController {

    @Resource
    private OperationLogMapper operationLogMapper;

    @RequestMapping("saveLog")
    public ResponseObject saveLog(OperationLog operationLog){
        try {
            if(null!=operationLog&&!StringUtils.isBlank(operationLog.getLogtype())){
                operationLog.setCreatetime(new DateTime());
                operationLogMapper.insert(operationLog);
            }
          return  ResponseUtil.SUCCESS();
        }catch (Exception e){
            e.printStackTrace();
         return    ResponseUtil.ERROR();
        }
    }




}
